﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="AOrganisationList.aspx.cs" Inherits="AB.ServiceDirectory.Design.Org.AOrganizationList"
    EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" language="Javascript">
        function Confirm_Edit() {
            if (confirm("Do you want to make this Organization active?") == true)
                return true;
            else
                return false;
        }
    </script>
</asp:Content>
<asp:Content ID="ContentTitle" ContentPlaceHolderID="ContentTitle" runat="server">
    <h2>
        Organization List</h2>
</asp:Content>
<asp:Content ID="Content" ContentPlaceHolderID="Content" runat="server">
    <asp:UpdatePanel ID="UpdatePanelOrganizationList" runat="server">
        <ContentTemplate>
            <div class="grid740 simplebox">
                <div class="titleh">
                    <h3 class="sorting_range">
                        <asp:LinkButton ID="LinkButtonAll" runat="server" CssClass="hg-blue" CommandName="all"
                            OnCommand="FilterByLetters_Command">All</asp:LinkButton>
                        <asp:LinkButton ID="LinkButton09" runat="server" CommandName="09" OnCommand="FilterByLetters_Command">0-9</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonAE" runat="server" CommandName="ae" OnCommand="FilterByLetters_Command">A B C D E</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonFJ" runat="server" CommandName="fj" OnCommand="FilterByLetters_Command">F G H I J</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonKN" runat="server" CommandName="kn" OnCommand="FilterByLetters_Command">K L M N </asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonOR" runat="server" CommandName="or" OnCommand="FilterByLetters_Command">O P Q R</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonSV" runat="server" CommandName="sv" OnCommand="FilterByLetters_Command">S T U V</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonWZ" CssClass="last" runat="server" CommandName="wz"
                            OnCommand="FilterByLetters_Command">W X Y Z</asp:LinkButton>
                        <span class="right">
                            <asp:HyperLink ID="LinkCreate" runat="server" CssClass="hg-blue" NavigateUrl="~/Organisation/OrganisationDetails.aspx">Create</asp:HyperLink>
                            <asp:CheckBox ID="CheckBoxInactive" runat="server" Text="Include In-active" AutoPostBack="True"
                                OnCheckedChanged="CheckBoxInactive_CheckedChanged" />
                        </span>
                    </h3>
                </div>
                <asp:ObjectDataSource ID="OrganizationObjectDataSource" runat="server" EnablePaging="True"
                    MaximumRowsParameterName="maxRows" SelectCountMethod="GetListOrganizationCount"
                    StartRowIndexParameterName="startRowIndex"
                    SelectMethod="GetOrganizationList" SortParameterName="sortType" TypeName="AB.ServiceDirectory.BO.AOrganizationBO"
                    OnSelecting="OrganizationObjectDataSource_Selecting">
                    <SelectParameters>
                        <asp:Parameter Name="filter" Type="Object" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:GridView ID="GridViewOrg" CssClass="tablesorter" runat="server" AutoGenerateColumns="False"
                    AllowPaging="True" PageSize="15" AllowSorting="True" DataSourceID="OrganizationObjectDataSource"
                    OnRowDataBound="GridViewOrg_RowDataBound" DataKeyNames="OrganizationId" OnRowCreated="GridViewOrg_RowCreated">
                    <Columns>
                        <asp:TemplateField HeaderText="Organisation Name" SortExpression="OrganisationName">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButtonOrganisationName" runat="server" CommandName='<%# Eval("OrganizationId") %>'
                                    CommandArgument='<%#Eval("IsActive") %>' OnCommand="LinkButtonOrganizationName_Command"
                                    Text='<%# Eval("OrganizationName") %>'></asp:LinkButton>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" Width="133px"/>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Head Office Address Line 1" SortExpression="AddressLine">
                            <ItemTemplate>
                                <asp:Label ID="LabelHeadOffice" runat="server" Text='<%# Eval("Address.AddressLine") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Postcode" SortExpression="PostCode">
                            <ItemTemplate>
                                <asp:Label ID="LabelPostCode" runat="server" Text='<%# Eval("Address.PostCode") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" Width="120px"/>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Contact" SortExpression="Contact">
                            <ItemTemplate>
                                <%# String.Format("{0} {1}",Eval("Contact.FirstName"),Eval("Contact.SurName")) %>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" Width="137px"/>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Is Active?" SortExpression="IsActive">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%#(bool)Eval("IsActive")?"Yes":"No"%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" Width="82px"/>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <blockquote>There are no items to show.</blockquote>
                    </EmptyDataTemplate>
                    <PagerStyle CssClass="pagination_table"></PagerStyle>
                </asp:GridView>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
